home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / hypergraphConnectionBeginMen < prev    next >
Encoding:
Text File  |  2003-07-17  |  3.4 KB  |  108 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17.  
  18. proc int connectionsSubMenu(string $editor, string $menu,
  19.     string $attrCmd, string $cmd, string $title, string $type)
  20. //
  21. //    Description:
  22. //
  23. //        Build a submenu for the popup connection menu for a given
  24. //        attribute type(single, double, triple, data, array
  25. //
  26. {
  27.     string    $getAttrsCmd    = $attrCmd+" "+$type;
  28.     string    $attrs[]        = `eval $getAttrsCmd`;
  29.     int        $numElements    = 2;
  30.     int        $length            = size($attrs);
  31.     if($length != 0) {
  32.         if($type != "all") {
  33.             menuItem -l $title -sm 1;
  34.         }else{
  35.             if($length > 8) {
  36.                 return $length;
  37.             }
  38.         }
  39.  
  40.         int        $i;
  41.         if($type != "multi") {
  42.             for ($i = 0 ; $i < $length ; $i += $numElements) {
  43.                 int $italicize    = ($attrs[$i+1] == "Connected"); 
  44.                 menuItem -l $attrs[$i]
  45.                     -italicized $italicize -boldFont $italicize
  46.                      -c ($cmd+"."+$attrs[$i]+" "+$editor);
  47.             }
  48.         }else{
  49.             for ($i = 0 ; $i < $length ; $i += $numElements) {
  50.                 menuItem -l $attrs[$i] -sm 1;
  51.                 int $italicize    = ($attrs[$i+1] == "Connected"); 
  52.                 int $j;
  53.                 for ($j = 0 ; $j < 3 ; $j++) {
  54.                     string $label = ($attrs[$i] + "[" + $j + "]");
  55.                     menuItem -l $label
  56.                         -italicized $italicize -boldFont $italicize
  57.                          -c ($cmd+"."+$attrs[$i]+" "+$editor);
  58.                 }
  59.                 setParent ..;
  60.             }
  61.         }
  62.         setParent -m $menu;
  63.     }
  64.     return $length;
  65. }
  66.  
  67. global proc hypergraphConnectionBeginMenu(string $editor, string $menu,
  68.     string $node, string $inputs)
  69. //
  70. //    Description:
  71. //        Called to initiate a connection when using the popup connection
  72. //        editing capability in the Hypergraph and Hypershade.  This will
  73. //        build a popup menu showing all the available attributes for 
  74. //        either inputs or outputs.
  75. //
  76. {
  77.     string    $attrCmd;
  78.     string    $cmd;
  79.     int        $subMenu = 1;
  80.  
  81.     setParent -m $menu;
  82.     popupMenu -e -deleteAllItems $menu;
  83.  
  84.     menuItem -l $inputs;
  85.     menuItem -divider true;    
  86.  
  87.     if($inputs == "Inputs") {
  88.         $attrCmd        = "attributeMenu -inputs "+$node+" -attrType ";
  89.         $cmd            = "hyperGraph -e -newInputConnection "+$node;
  90.     }else{
  91.         $attrCmd        = "attributeMenu -outputs "+$node+" -attrType ";
  92.         $cmd            = "hyperGraph -e -newOutputConnection "+$node;
  93.         int $len;
  94.         $len = connectionsSubMenu($editor, $menu, $attrCmd, $cmd, "All", "all");
  95.         if($len <= 8) {
  96.             $subMenu = 0;
  97.         }
  98.     }
  99.  
  100.     if($subMenu == 1) {
  101.         connectionsSubMenu($editor, $menu, $attrCmd, $cmd, "Single", "single");
  102.         connectionsSubMenu($editor, $menu, $attrCmd, $cmd, "Double", "double");
  103.         connectionsSubMenu($editor, $menu, $attrCmd, $cmd, "Triple", "triple");
  104.         connectionsSubMenu($editor, $menu, $attrCmd, $cmd, "Data",   "data");
  105.         connectionsSubMenu($editor, $menu, $attrCmd, $cmd, "Array",  "multi");
  106.     }
  107. }
  108.